/* 动态按钮按下效果优化 */
.glass-button,
.control-btn,
.tab-btn,
.save-btn,
.close-btn {
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  position: relative;
  overflow: hidden;
  -webkit-tap-highlight-color: transparent;
  transform: translateZ(0);
  will-change: transform, box-shadow, background;
}

/* 所有按钮通用的按下效果 */
.glass-button:active,
.control-btn:active,
.tab-btn:active,
.save-btn:active,
.close-btn:active {
  transform: scale(0.95);
  box-shadow: 
    0 5px 15px rgba(0, 0, 0, 0.3),
    inset 0 0 15px rgba(255, 255, 255, 0.1);
}

/* 按钮悬停效果 */
.glass-button:hover,
.control-btn:hover,
.tab-btn:hover,
.save-btn:hover {
  transform: translateY(-2px);
  box-shadow: 
    0 10px 20px rgba(0, 0, 0, 0.3),
    inset 0 0 20px rgba(255, 255, 255, 0.15);
}

/* 特定按钮效果 */
.glass-button {
  border-color: rgba(255, 255, 255, 0.2);
}

.glass-button:hover {
  border-color: rgba(255, 255, 255, 0.5);
}

.glass-button:active {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.1) 100%);
  border-color: rgba(255, 255, 255, 0.4);
}

/* 控制按钮 */
.control-btn:active {
  background: linear-gradient(135deg,
    rgba(100, 181, 246, 0.8) 0%,
    rgba(66, 165, 245, 0.6) 100%);
  box-shadow: 
    0 5px 20px rgba(66, 165, 245, 0.4),
    inset 0 0 10px rgba(255, 255, 255, 0.2);
}

/* 标签按钮 */
.tab-btn:active {
  background: linear-gradient(135deg,
    rgba(76, 175, 80, 0.8) 0%,
    rgba(56, 142, 60, 0.6) 100%);
  color: white;
}

.tab-btn.active:active {
  background: linear-gradient(135deg,
    rgba(33, 150, 243, 0.9) 0%,
    rgba(30, 136, 229, 0.7) 100%);
  box-shadow: 0 5px 20px rgba(33, 150, 243, 0.4);
}

/* 保存按钮 */
.save-btn:active {
  background: linear-gradient(135deg,
    rgba(255, 193, 7, 0.8) 0%,
    rgba(255, 160, 0, 0.6) 100%);
  box-shadow: 0 5px 20px rgba(255, 193, 7, 0.4);
}

/* 关闭按钮 */
.close-btn:active {
  background: linear-gradient(135deg,
    rgba(244, 67, 54, 0.8) 0%,
    rgba(229, 57, 53, 0.6) 100%);
  color: white;
  box-shadow: 0 5px 20px rgba(244, 67, 54, 0.4);
}

/* 赞助按钮效果 */
#sponsorBtn {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.15) 0%,
    rgba(255, 255, 255, 0.05) 100%);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

#sponsorBtn:hover {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.25) 0%,
    rgba(255, 255, 255, 0.1) 100%);
  border-color: rgba(255, 255, 255, 0.3);
}

#sponsorBtn:active {
  background: linear-gradient(135deg,
    rgba(255, 255, 255, 0.35) 0%,
    rgba(255, 255, 255, 0.15) 100%);
  box-shadow: 0 5px 25px rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.4);
}

/* 按钮涟漪效果 */
.glass-button::after,
.control-btn::after,
.tab-btn::after,
.save-btn::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.5);
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s, opacity 0.6s;
  pointer-events: none;
}

.glass-button:active::after,
.control-btn:active::after,
.tab-btn:active::after,
.save-btn:active::after {
  width: 150px;
  height: 150px;
  opacity: 0;
}

/* 图标动画 */
.glass-button i,
.control-btn i,
.save-btn i {
  transition: transform 0.3s ease;
  display: inline-block;
}

.glass-button:active i,
.control-btn:active i,
.save-btn:active i {
  transform: scale(1.2);
}

/* 音乐控制按钮特定效果 */
.music-controls .control-btn {
  transition: all 0.2s ease;
}

.music-controls .control-btn#playBtn:active {
  background: linear-gradient(135deg,
    rgba(76, 175, 80, 0.9) 0%,
    rgba(56, 142, 60, 0.7) 100%);
}

.music-controls .control-btn#stopBtn:active {
  background: linear-gradient(135deg,
    rgba(244, 67, 54, 0.9) 0%,
    rgba(229, 57, 53, 0.7) 100%);
}

/* 音量滑块 */
.volume-slider::-webkit-slider-thumb {
  transition: all 0.2s ease;
}

.volume-slider::-webkit-slider-thumb:active {
  transform: scale(1.3);
  box-shadow: 0 0 10px rgba(33, 150, 243, 0.8);
}

/* 键盘导航支持 */
.glass-button:focus-visible,
.control-btn:focus-visible,
.tab-btn:focus-visible,
.save-btn:focus-visible,
.close-btn:focus-visible {
  outline: 2px solid rgba(33, 150, 243, 0.8);
  outline-offset: 2px;
  box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
}

/* 备用方案：不支持 :focus-visible 的浏览器 */
.glass-button:focus:not(:active),
.control-btn:focus:not(:active),
.tab-btn:focus:not(:active),
.save-btn:focus:not(:active),
.close-btn:focus:not(:active) {
  outline: 2px solid rgba(33, 150, 243, 0.8);
  outline-offset: 2px;
  box-shadow: 0 0 15px rgba(33, 150, 243, 0.5);
}

/* 禁用状态 */
.glass-button:disabled,
.control-btn:disabled,
.tab-btn:disabled,
.save-btn:disabled {
  opacity: 0.5;
  transform: none !important;
  cursor: not-allowed;
}

.glass-button:disabled:active,
.control-btn:disabled:active,
.tab-btn:disabled:active,
.save-btn:disabled:active {
  transform: none !important;
  box-shadow: inherit !important;
}

.glass-button:disabled::after,
.control-btn:disabled::after,
.tab-btn:disabled::after,
.save-btn:disabled::after {
  display: none;
}

/* 响应式调整 */
@media (max-width: 768px) {
  .glass-button:active,
  .control-btn:active,
  .tab-btn:active,
  .save-btn:active,
  .close-btn:active {
    transform: scale(0.97);
  }
  
  /* 移动端减少涟漪效果尺寸 */
  .glass-button:active::after,
  .control-btn:active::after,
  .tab-btn:active::after,
  .save-btn:active::after {
    width: 100px;
    height: 100px;
  }
}

/* 减少动画偏好的用户支持 */
@media (prefers-reduced-motion: reduce) {
  .glass-button,
  .control-btn,
  .tab-btn,
  .save-btn,
  .close-btn,
  .glass-button::after,
  .control-btn::after,
  .tab-btn::after,
  .save-btn::after,
  .glass-button i,
  .control-btn i,
  .save-btn i {
    transition-duration: 0.01ms !important;
    animation-duration: 0.01ms !important;
  }
}